Detecting skin tone in images

ABSTRACT

One aspect of the subject matter described in this specification can be implemented in a method that includes sampling an image to generate a sample portion; evaluating pixels in the sample portion to determine whether the pixels correspond to skin tone colors; generating, based on the determination, a skin tone result indicating a confidence level that the received image includes a depiction of human skin; and providing the skin tone result to an image management application to indicate a likelihood the image depicts a human face.

This application claims the benefit of U.S. Provisional Application No.61/142,606, filed Jan. 5, 2009.

TECHNICAL FIELD

The present disclosure relates to detecting skin tone in images, such asto determine whether an image depicts a person's face.

BACKGROUND

Digital photography, a popular pastime, utilizes digital technology toproduce digital images. Digital images (or “images”) also can becreated, for example, by graphical editing software (e.g., photo editingor drawing software), digital video equipment, and scanners.

After production, an original image (e.g., a photograph) can beprocessed. Some instances of image processing can produce a new imagefrom an original image. For example, cropping (i.e., extracting aportion of an image) can produce a new image from an original image.Other instances of image processing can ascertain information about anoriginal image without producing a new image. For example,facial-detection processing can determine whether an image depicts oneor more faces.

Images can depict visual information using various color models. A colormodel can describe the way colors are represented, e.g., using one tofour values representing color components. For example, in ared-green-blue (RGB) color model, a color can be described using threevalues—one each for red, green, and blue. Thus, three values can be usedto describe the color of each pixel in an RGB image. When an intendedinterpretation of a color model's components is known, the set ofpossible colors can be referred to as a color space. For example, thethree values associated with an RGB color can be mixed additively toproduce a specific color in an RGB color space.

SUMMARY

This disclosure describes technologies and techniques for detecting skintone in images. Skin tone can correspond to a color or set of colorswithin a color space that are characteristic of human flesh. Detectingskin tone in an image can include ascertaining whether an image depictssuch characteristic colors.

A facial detection system or application can provide an indication thata face is believed to be depicted in an image or a portion of an image.The present inventors recognized a need to assess the accuracy of adetection made by such a facial detection system. Further, the need todetermine whether an image represents one or more skin tone colors wasrecognized. Additionally, the need to discount a facial detection in animage that does not represent one or more skin tone colors wasrecognized. The need to eliminate or ignore indications of facialdetections in images not corresponding to facial representations in anoverall facial correlation system further was recognized. In general,one aspect of the subject matter described in this specification can beimplemented in a method that includes sampling an image to generate asample portion; evaluating pixels in the sample portion to determinewhether the pixels correspond to skin tone colors; generating, based onthe determination, a skin tone result indicating a confidence level thatthe received image includes a depiction of human skin; and providing theskin tone result to an image management application to indicate alikelihood the image depicts a human face.

These and other implementations can optionally include one or more ofthe following features. The sampling the image further can includeidentifying a region substantially one third as wide as the image,substantially centered horizontally relative to the image, substantiallyone third as tall as the image, and offset below vertically centeredrelative to the image. The evaluating pixels further can includeconverting a selected pixel to a normalized red-green color space; andcomparing the selected pixel to a predetermined skin tone region in thenormalized red-green color space. The evaluating pixels further caninclude generating a skin tone pixel count by comparing the pixels to apredetermined skin tone region in a color space. The evaluating pixelsfurther can include comparing the skin tone pixel count to a count ofthe pixels to generate a skin tone percentage; and determining, based onthe skin tone percentage and a predetermined skin tone percentagethreshold, that the sample portion includes a depiction of human skin.The generated skin tone result can include an indication that the imageis suitable for facial recognition processing.

The techniques described in this specification can be implemented torealize one or more of the following advantages. In general, thepresence or absence of a human face (or “face”) in an image can bedetected. Thus, the accuracy of facial detection and recognition can beimproved. In specific, facial detection accuracy can be improved byeliminating or ignoring indications of facial detections in images notrepresenting one or more skin tone colors.

Further, techniques described in this specification also can beimplemented to realize one or more of the following advantages. Skintone detection can be accurately performed despite the presence ofobjects, e.g., hats, glasses, goggles and other such accessories,depicted relative to a face. Skin tone detection also can be performedaccurately regardless of skin color differences (e.g., based on race),lighting conditions, and facial hair. Aspects of skin tone detection canpermit efficient production of implementations, and production ofefficiently performing implementations. Efficient facial detectionimplementations can increase overall processing-resource efficiency andcan be used in real-time systems. A skin tone detection process also canbe configured to recognize images having artificially modified colorenvironments (e.g., black and white, or sepia) such that a positiveassertion that a person is not depicted in such images can be avoided.

The details of one or more implementations are set forth in theaccompanying drawings and the description below. Other features andadvantages will be apparent from the description and drawings, and fromthe claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows an exemplary overview of detecting skin tone.

FIG. 2 shows an exemplary image management application for detectingskin tone.

FIG. 3 is a flowchart showing an exemplary overall process for detectingskin tone.

FIG. 4 is a diagram showing an exemplary extraction of a sample portionof an image.

FIG. 5 is a flowchart showing an exemplary process for detecting skintone in a sample portion of an image.

FIG. 6 is a diagram showing an exemplary skin tone region of a colorspace.

FIG. 7 is a flowchart showing an exemplary process for accepting orrejecting an image based on skin tone detection.

Like reference symbols indicate like elements throughout thespecification and drawings.

DETAILED DESCRIPTION

Facial detection processing can include detecting faces in images.Facial recognition processing can include determining, based on adetected face, which person is represented. A facial detection processcan determine if an image includes face-like patterns. However, facialrecognition can be inaccurate based on certain detection conditions. Forexample, facial detection processing can detect a face in an image orimage portion that actually depicts something other than a face (e.g.,clouds or leaves on a tree). Combining a result generated by skin tonedetection processing with facial detection processing can improve thelikelihood that a positive detection in fact represents a face.

In general, as shown in FIG. 1, an image can be processed to detect skintone. A facial detection process can determine that a given candidateregion of the image includes a depiction of a face (e.g., using spatialpattern recognition). An identified candidate region can be processed todetect whether color information representative of skin tone is present.Further, the relative amount of skin tone colors compared to non-skintone colors in candidate regions can be used to determine a likelihoodcandidate regions depict faces.

FIG. 1 shows an exemplary overview 100 of detecting skin tone. Theoverview 100 includes an original image 102. The original image 102 canbe a digital image which depicts visual information such asrepresentations of people, plants, and animals.

A first candidate region 114 of the original image 102 can be a regionin which a face has been detected by a facial detection process. In someimplementations, the first candidate region can be a facial-detectionrectangle. In the case of the original image 102, the first candidateregion 114 includes a depiction of a face of a young girl. Thecoordinates of the first candidate region 114 can be provided by thefacial detection process. The coordinates also can be calculated (e.g.,by the skin tone detection processor 108) based on information providedby the facial detection process (e.g., coordinates of facial featuressuch as eyes, nose, and mouth, and an angle of the face).

A second candidate region 116 of the original image 102 also can be aregion in which a face has been detected by a facial detection process.However, the second candidate region 116 does not depict a person'sface.

Facial detection can be performed without regard to color (e.g., using agrayscale version of an image). Using, e.g., spatial patternrecognition, a facial detection process can detect a supposed face basedon depictions (e.g., dark areas) that coincidently have a face-likepattern (e.g., approximating eyes, nostrils, and a mouth) but that donot actually depict a face. The second candidate region 116 includesdark regions that a facial detection process could mistake for eyes, anose, and nostrils. In reality, however, the second candidate region 116depicts foliage having a coincidentally face-like pattern. A facialdetection process also can detect actual facial patterns and featuresthat do not correspond to human faces (e.g., animals, statues, orcartoons).

A face image 104 can be an extraction from the original image 102,corresponding to the first candidate region 114. The face image 104 cansubstantially depict a single face. The face image 104 can be producedby a facial detection process or based on information provided by afacial detection process, such as coordinates or other data defining anarea. In addition, the face image 104 also can be an indicated portionof the original image 102 rather than a separate image (e.g., a distinctfile or memory buffer).

The foliage image 106 can be produced or indicated similarly to the faceimage 104, although corresponding to the second candidate region 116.

A skin tone detection processor 108 can receive an image, such as theface image 104, as input and produce an indication, such as a flag ornumerical value, of whether the image likely depicts a face as output110. The indication can be produced based on, e.g., the amount of skintone detected in the image relative to the image size. Further, theoutput 110 can represent a confidence level that the image includes aface. The confidence level can be based on any range of values.

The input to the skin tone detection processor 108 can be a single imagesubstantially depicting only a region corresponding to a detected face(e.g., the face image 104 extracted from the original image 102).Alternatively, the skin tone detection processor 108 can receive asinput a full image including depictions of one or more faces and one ormore locations corresponding to the regions in which a face wasdetected. In some implementations, the skin tone detection processor 108can receive as input multiple images extracted from the same originalimage. The skin tone detection processor 108 can be configured to useadditional information provided by the full image or multiple images toimprove the accuracy of the skin tone detection (e.g., comparing colorsignatures across the full image, or comparing brightness across themultiple images).

The skin tone detection processor 108 can produce as output 110 anindication of whether an input image likely depicts a face. Theindication can be based on the amount of skin tone detected in the inputimage or portion thereof. In some implementations, the output 110 can beBoolean and can indicate whether a certain threshold for detected skintone was reached (e.g., “Accept” or “Reject”). In other implementations,the output 110 can correspond to a confidence level or numerical value,as described with respect to FIG. 2.

In operation, the face image 104 and the foliage image 106 can be inputinto a skin tone detection processor 108. The images can be input intothe skin tone detection processor 108 sequentially or simultaneously.Based on the detection of skin tone in the face image 104, the skin tonedetection processor 108 can output 110 an “Accept” indication 112. Incontrast, based on detecting an absence of skin tone in the foliageimage 106, the skin tone detection processor 108 can output 110 a“Reject” indication 118.

In general, as shown in FIG. 2, a system can include a component thatreceives as input an image and generates a result indicating whetherskin tone was detected in the image.

FIG. 2 shows an exemplary image management application 200 for detectingskin tone. The image management application 200 can be a softwareapplication executing on a computer system. The image managementapplication 200 can access resources of the computer system (e.g.,memory or disk storage) via an operating system or application platform.The image management application 200 can include a user-interfacethrough which the image management application 200 receives input from auser and displays output to the user. Although shown as a singleapplication, in some implementations the functionality of the imagemanagement application 200 can be accomplished using multipleapplications.

The image management application 200 can include software systems ormodules, such as an image correlator 202 and a skin tone detector 206.The image management application 200 also can enable software componentsto exchange information. The software components can be independentprocesses (e.g., threads) operating within the image managementapplication 200, remote functions (e.g., invoked using a remoteprocedure call), or local functions (e.g., methods or procedures) calledby a control process of the image management application 200.

An image correlator 202 can be an application, process, or systemcomponent configured to correlate images. For example, the imagecorrelator 202 can correlate images of a same individual using facialdetection and facial recognition functionality. Further, the imagecorrelator 202 can, e.g., have confidence levels for the facialdetection and the facial recognition functions. As part of assessing aconfidence level, the image correlator 202 can use reliabilityindications (e.g., an output result 214 generated by the skin tonedetector 206).

The skin tone detector 206 can be an application, process, systemcomponent, or combination thereof configured to detect skin tone in animage (e.g., the input image 204). The skin tone detector 206 furthercan produce the output result 214 indicating the result of skin tonedetection.

An input image 204 represents a digital image. The input image 204 canbe data stored in memory or a file system according to a format (e.g.,bitmap, pixmap, vector graphics, compressed, or uncompressed). The inputimage 204 can be transferred from the image correlator 202 to the skintone detector 206, e.g., by value or by reference. Transferring by valuecan include copying the input image 204 to an area of memory for use bythe skin tone detector 206. Transferring by reference can includepassing only a reference (e.g., a memory or file pointer) for the imagedata to the skin tone detector 206. The skin tone detector 206 can thusaccess the image from a location common to the image correlator 202.

In some implementations, the input image 204 can correspond to aproposed facial detection made by the image correlator 202, the imagemanagement application 200, or component thereof. In otherimplementations, the input image 204 can correspond to an original imageincluding one or more such proposed facial detections. The one or moreproposed facial detections can be coordinates relative to the originalimage of, e.g., rectangular regions including the proposed facialdetections, or facial feature (e.g., eyes, nose, or mouth) locations. Instill other implementations, the input image 204 can be one or moreimages corresponding to one or more such proposed facial detections inan original image.

In implementations in which the input image 204 corresponds to anoriginal image, the skin tone detector 206 can be adapted to use theoriginal image to improve the accuracy of skin tone detection inproposed facial detections and the rejection of proposed facialdetections depicting non-face objects (e.g., leaves or clouds). In afirst example, the skin tone detector 206 can examine other regions ofthe original image of similar size and shape as the proposed facialdetection to assess whether the other regions have similar color to theproposed facial detection. If an original image includes many moreregions with similar color, and specifically regions not proposed asfacial detections, the skin tone detector 206, e.g., can determine thefacial detection is less likely to be accurate or more strictlyscrutinize the facial detection. Thus, the skin tone detector 206 canevaluate the consistency between the number of proposed facialdetections in an image and a color comparison of the proposed facialdetections to image areas not corresponding to proposed facialdetections. In a second example, the skin tone detector 206 can examinea region of the original image of similar size and shape as a facialdetection but offset from the facial detection to the left, right, topor bottom by half the region size. If the examined region hassubstantially the same color tone as the facial detection region, theskin tone detector 206 can more strictly scrutinize the facial detectionor reject the facial detection.

In implementations in which the input image 204 includes one or moreimages corresponding to one or more such proposed facial detections inan original image, color information from the proposed facial detectionstogether can improve the accuracy of skin tone detection for theindividual proposed facial detections. For example, one or more testcolor spaces used in skin tone detection, as discussed relative to FIGS.5 and 6, can be adapted to the particulars of the proposed facialdetections. Similar lighting conditions, for instance, can affect theappearance of skin of multiple individuals in a single image.

An output result 214 is an indication of the skin tone relative to theinput image 204, a sample thereof, or a facial detection in the inputimage 204. For example, the output result 214 can be a Booleanindication of whether to accept or reject the proposed facial detection(e.g., true for accept and false for reject). The indication can bebased on whether a certain threshold for detected skin tone is reached(e.g., more than 50%, 75%, or 90% of the pixels corresponding to skintone). Alternatively, the output result 214 can be a numerical value.For example, the output result 214 can indicate how likely the inputimage is to represent human skin, such as based on a value range. On theother hand, the output result 214 can represent the distance, e.g., withrespect to a color space, between the input image's (or sample's) colorsand the closest skin tone colors that correspond to human flesh.

In general, as shown in FIG. 3, skin tone in an image can be detected todetermine whether the image likely represents skin. Detecting skin tonecan include sampling the image and evaluating the pixels in the sampledportion individually to determine overall whether the pixels representskin tone. The result of the detection can be provided to a requestingcomponent (e.g., the image correlator 202), application or system.

FIG. 3 is a flowchart showing an exemplary process 300 for detectingskin tone. A skin tone detection processor can be configured to detectskin tone in an image, such as an image in which one or more faces havebeen detected. The images can include face-like patterns whichcorrespond to faces of people or other objects (e.g., rocks or treebark). Further, the skin tone detection processor can be configured todetect skin tone in a variety of lighting and filter (e.g., sepia)conditions. Additionally, the skin tone detection processor can beconfigured to detect skin tone representing various types ofpigmentation. The skin tone detection processor can receive an image(302). For example, an application (or component thereof) associatedwith the skin tone detection processor can call the skin tone detectionprocessor and transfer the image to the skin tone detection processor.The skin tone detection processor can receive the image (302) as part ofthe call and the transfer can be by reference (e.g., passing a pointerto a memory location of the image) or by value (e.g., passing the imageas data stored in memory).

The skin tone detection processor can extract a portion from thereceived image (304). The extraction can be performed as described withreference to FIG. 4. Extracting the portion can include selecting aportion, copying a portion, or referring to a portion of the image. Theportion can be, e.g., a specific region of the image. Alternatively, theportion can include individual pixels distributed throughout the imageor pixels located within one or more specific portions of the image. Ina first example, the portion can be rectangular and based on either orboth of a size of the image (e.g., ⅓ the width and ⅓ the height of theimage) and an angle of a face depicted in the image (e.g., relative tothe image coordinates). The portion can be substantially centeredrelative to the image, centered but offset to below center, or situatedin another location. In a second example, the portion can be everyn^(th) pixel in a region, such as the rectangular region described inthe first example. In a third example, the portion can be selected basedon the color, brightness, or other characteristic of the pixels (e.g.,all pixels within a brightness range). Any methodology can be used toselect the portion.

The skin tone detection processor can evaluate pixels from the extractedportion (306) to determine whether the pixels correspond to skin tonecolors. The evaluation can be performed as described relative to FIGS. 5and 6. Evaluating pixels can include iterating through some or all ofthe pixels in the portion and individually considering the pixels. Apixel can be converted to one or more color spaces and analyzed todetermine whether the pixel corresponds to a skin tone. The skin tonedetection processor can maintain information about the overall portionbased on the evaluation of the individual pixels. For example, the skintone detection processor can count the number of pixels in the portionand the number of pixels corresponding to a skin tone. Based on theinformation, the skin tone detection processor can determine whether thepixels overall correspond to skin tone colors. For example, the skintone detection processor can compare the number of skin tone pixels tothe total number of pixels to make the determination.

Based on the determination, the skin tone processor can generate aresult (308) that provides a confidence level regarding whether theimage received (302) depicts skin. The result can consequently indicatewhether the image is more or less likely to depict a face.

The skin tone detection processor can provide the result (310) to animage management application (e.g., the image management application 200shown in FIG. 2) or a component thereof (e.g., the image correlator 202shown in FIG. 2). Providing the result (310) can include transferring anumerical value representing the determination result or otherindication regarding the determination result (e.g., an “accept” or“reject” indication).

In general, as shown in FIG. 4, a sampled portion from an image can beused in detecting skin tone. Images of faces can include skin toneelements (e.g., skin of a face) and non-skin tone elements (e.g., hair,hats, sunglasses, clothing, foliage, etc.). Using a portion of an imagefor skin tone detection can improve the detection accuracy by maximizingskin tone elements while minimizing non-skin tone elements.

FIG. 4 is a diagram showing an exemplary extraction of a sample portion402 from an image 400. An image 400 can depict a face (e.g., a face of ayoung girl). Although the image 400 depicts a face, the image 400 caninclude elements not corresponding to skin tone, such as background andclothing. The accuracy of a skin tone detection process that evaluateswhether pixels correspond to skin tone colors can be improved byselecting a sample portion 402 from the image 400 that will be morelikely to include pixels corresponding to a facial region. For example,based on a facial detection process, images substantially representingonly a face can be produced. In one example, the images can berectangular. The rectangular images, despite wide variations inlighting, face angle, size, and non-facial image data, can consistentlyinclude pixels representing skin tone colors in one or more particularregions that can be sampled.

The sample portion 402 can be rectangular in shape. In otherimplementations, the sample portion 402 can be another shape (e.g., atriangle or circle). The sample portion 402 can have the same aspectratio as the image 400. The sample portion 402 alternatively can have afixed aspect ratio (e.g., 3:4) irrespective of the aspect ratio of theimage 400. The sample portion 402 can be sized proportionately to theimage 400. For example, the width 412 of the sample portion 402 can be aquarter or third of the width of the image 400. Similarly, the height406 of the sample portion 402 can be a quarter or third of the height ofthe image 400. The proportion of the width 412 of the sample portion 402relative to the image 400 can be the same or different than theproportion of the height 406 of the sample portion 402 relative to theimage 400. Alternatively, the size and shape of the sample portion 402can depend on the depictions of the image 400. For example, the shape ofthe sample portion 402 can correspond to a two-dimensional projection ofa rectangle rotated in three-dimensional space according to the angle ofa face depicted in the image 400.

The sample portion 402 can be positioned horizontally approximately inthe center of the image 400. Thus, the distance 410 from the left edgeof the image 400 to the left edge of the sample portion 402 can beapproximately equal to the width 412 of the sample portion and thedistance 414 from the right edge of the sample portion 402 to the rightedge of the image 400.

Furthermore, the sample portion 402 can be positioned verticallyapproximately in the center of the image 400. Thus, the distance 404from the top edge of the image 400 to the top edge of the sample portion402 can be approximately equal to the height 406 of the sample portion402 and the distance 408 from the bottom edge of the sample portion 402to the bottom edge of the image 400 (not shown). Alternatively, thesample portion 402 can be offset to below center such that the distance404 from the top of sample portion 402 to the top of the image 400 isgreater than the distance 408 from the bottom of the sample portion 402to the bottom of the image 400.

In general, as shown in FIG. 5, pixels from a sample portion of an imagecan be evaluated as part of detecting whether the sample portionrepresents skin tone. The process 500 can include individuallyconsidering pixels, converting pixels from an original color space toone or more test color spaces, checking for various conditions, andmaintaining a count of skin tone pixels.

FIG. 5 is a flowchart showing an exemplary process 500 for detectingskin tone in a sample portion of an image. A skin tone detectionprocessor can be configured to detect skin tone in samples from images,such as images in which faces have been detected. The samples can beportions of images likely to include skin tone pixels. Further, the skintone detection processor can be configured to detect skin tone in avariety of lighting conditions and for various types of pigmentation.The skin tone detection processor can receive a sample portion (502).For example, an application (or component thereof) associated with theskin tone detection processor can call the skin tone detection processorand transfer the sample portion to the skin tone detection processor.The skin tone detection processor can receive the sample portion (502)as part of the call and the transfer can be by reference or by value.The skin tone detection process 500 also can be part of a larger processhaving access to the image and the sample portion (e.g., the process 300shown in FIG. 3) thus obviating the need to transfer the sample portion.

The skin tone detection processor can select a pixel from the sampleportion (504). Selecting a pixel can involve individually consideringpixels in the sample portion through an iterative process. For example,the pixels in a sample portion can be loaded into a buffer representedas an array. Using a loop, the skin tone detection processor can executea pass of the loop for pixels in the sample portion. The skin tonedetection processor can select (504) each pixel in the sample portion ora subset of the pixels in the sample portion (e.g., every other or everythird pixel).

Pixels in the sample portion can be represented with varying numbers ofbits. For example, pixel colors can be four-dimensional and thus havefour components, such as red, green, blue and transparency. Thecomponents can be represented by, e.g., 4, 8, or 16 bits. Thus, eachpixel can be represented by, e.g., 16, 32 or 64 bits in total.Similarly, pixel colors can be three dimensional and have threecomponents (e.g., red, green and blue (RGB) or hue, saturation andlightness (HSL)).

The skin tone detection processor can evaluate whether a pixel color isskin tone in various test color spaces. The pixel color selected fromthe sample portion can be associated with an original color space andthen converted (506) to one or more test color spaces. Converting froman original color space to a test color space can simplify theevaluation of whether a pixel is skin tone. Converting also can improvethe accuracy of the evaluation. Converting a pixel color to multipletest color spaces also can allow comparison between and combination oftest results using the multiple test color spaces. For example, a pixelcolor can be converted to a first test color space adapted to improvethe accuracy of positive skin tone detection but in which false positiveskin tone detection also can occur. Testing the pixel color in a secondtest color space can corroborate the test result in the first test colorspace, or indicate a likelihood of results in the first test color spacerepresenting falsely positive skin tone detection.

Furthermore, the skin tone detection processor can convert the selectedpixel (506) from a three-dimensional (e.g., RGB) or four-dimensional(e.g., RGB with transparency, or cyan, magenta, yellow, and key (CMYK))original color space to a one-, two-, or three-dimensional test colorspace. For example, a two-dimensional test color space, such asred-green (R-G) or red-blue (R-B), can provide accurate and efficientskin tone detection.

Pixels can be converted from an original color space to a test colorspace using a variety of techniques. For example, to convert from afour-dimensional color space to a three-dimensional color space, onepixel component, such as transparency, can be ignored. Alternatively, atransparency component can be equated with white and mixed with theother color components to convert from a four-dimensional color space toa three-dimensional color space.

To convert from a three-dimensional color space to a two-dimensionalcolor space, a variety of techniques also can be used. In someimplementations, one of the three components can be ignored. In otherimplementations, a pixel in a three-dimensional color space (e.g., RGB)can be converted to a different three-dimensional color space (e.g., HSLspace) and one of the three components (e.g., lightness) can then beignored. In still other implementations, the skin tone detectionprocessor can divide one color component of a pixel by the pixel'sluminosity.

Luminosity can be calculated in various ways. Where R represents a redcomponent of a pixel color, G represents a green component, and Brepresents a blue component, the luminosity (L) can be calculated usingthe formula:

L=(0.299×R)+(0.587×G)+(0.144×B).

Alternatively, luminosity can be calculated using the formula:

L=R+G+B.

In other implementations, assuming a max operation selects the largestvalue from a list of values and a min operation selects the smallestvalue from a list of values, luminosity can be calculated using theformula:

$L = {\frac{1}{2} \times {\left( {{\max \left( {R,G,B} \right)} + {\min \left( {R,G,B} \right)}} \right).}}$

In two-dimensional color space, each pixel can have two components. Forexample, pixels in R-G color space (or R-G space) can have a red and agreen component, or in R-B color space, a red and a blue component. If apixel is converted (506) to an R-G color space, the pixel's redcomponent (R_(new)) can be calculated using the formula:

$R_{new} = {\frac{R}{L}.}$

The pixel's green component (G_(new)) can be calculated using theformula:

$G_{new} = {\frac{G}{L}.}$

Depending on the luminosity formula used, the new red and greencomponents can be normalized such that the range of possible values foreach component is 0.0-1.0. The red and green components also can benormalized after conversion.

In some implementations, the skin tone detection processor can determinewhether a selected pixel is substantially black or far from neutral(508) or whether a selected pixel is substantially neutral (510) beforeconverting the selected pixel to a test color space (506). In otherimplementations the skin tone detection processor can make thesedeterminations after converting a selected pixel to a test color space(506).

In either case, the skin tone detection processor can determine whethera color of a selected pixel is substantially black or far from neutral(508). The determination can eliminate a pixel from furtherconsideration that is very unlikely to correspond to skin tone or forwhich skin tone detection is unreliable. For example, a pixel that issubstantially black can lead to unreliable skin tone detection. Becausethe pixel appears substantially black, the components of the pixel color(e.g., hue) can be substantially irrelevant visually and thus lesscarefully defined when an image is produced than for a pixel whosecomponents are visually noticeable.

Furthermore, a pixel color which is far from neutral can be highlysaturated and very unlikely to correspond to skin tone. A neutral colorcan be a color for which the color components are equal (e.g., R=G=B)and can appear to be black, gray, or white. A highly saturated color canbe visually far from neutral colors. Saturation can be calculated orassessed using a variety of techniques. In a first example, highlysaturated colors can correspond to a region of a two-dimensional colorspace such as represented in a coordinate system (e.g., such as thediagram shown in FIG. 6 of a color space coordinate system). A store ofcoordinates defining a polygonal region in the coordinate system candefine highly saturated colors. The skin tone detection processor candetermine whether a pixel color is far from neutral by assessing whetherthe color of the pixel is within the polygonal region. In a secondexample, saturation can be calculated using, e.g., two or three colorcomponents of a pixel. The components used can depend on whether thepixel is represented in two- or three-dimensional color space. In athree-dimensional color space, saturation (S) can be calculated usingthe formula:

$S = {\frac{{\max \left( {R,G,B} \right)} - {\min \left( {R,G,B} \right)}}{\max \left( {R,G,B} \right)}.}$

In a two-dimensional color space, saturation can be calculated using theformula:

$S = {\frac{{\max \left( {R,G} \right)} - {\min \left( {R,G} \right)}}{\max \left( {R,G} \right)}.}$

In a normalized two-dimensional color space in which luminosity has beenremoved (e.g., R-G space), saturation can be calculated using theformula:

$S = {\sqrt{\left( {R - \frac{1}{3}} \right)^{2} + \left( {G - \frac{1}{3}} \right)^{2}}.}$

Such saturation formulas can provide a value representing the saturationfrom a minimum value to a maximum value (e.g., 0-255, or 0.0-1.0). Ifhigher values (e.g., 255) represent high saturation, the skin tonedetection processor can determine that pixels above a certain threshold(e.g., 240) are far from neutral (i.e., highly saturated).

If the skin tone detection processor determines (508) that a pixel coloris substantially black or far from neutral, the skin tone detectionprocessor can ignore the pixel and determine (518) whether more pixelsneed to be selected.

If, on the other hand, the skin tone detection processor determines thatthe pixel color is not substantially black and not far from neutral, theskin tone detection processor can determine (510) whether the pixelcolor is substantially neutral. As mentioned, a neutral color can be acolor for which the color components are equal (e.g., R=G=B) and canappear to be black, gray, or white. A pixel color that is substantiallyneutral can result from an input image, and therefore a sample portionof the input image, having a grayscale color signature. In such animage, and portions thereof, substantially all pixels can have a similarcharacteristic of being substantially neutral. Grayscale images lackcolor information and therefore can be unsusceptible to skin tonedetection. In addition, neutral colors can be uncharacteristic of humanskin and therefore not recognized as skin tone. In addition tograyscale, the skin tone detection processor in some implementations canbe configured to detect other artificial color signatures (e.g., sepia).Because other artificial color signatures may prevent accurate skin tonedetection, detection of such signatures can allow a processor to provideoutput indicating, e.g., that no information can be provided about theimage through skin tone detection or that the image passes (i.e., isaccepted by) a skin tone evaluation.

The skin tone detection processor can determine that a color of a pixelis neutral (510), and increment a neutral count (516). The neutral countcan be a number representing the pixels in a sample portion which aresubstantially neutral. The neutral count can be used when all the pixelsin a sample portion have been evaluated to determine, e.g., that thesample portion is grayscale. For example, the neutral count can bedivided by the total pixels in an image to generate a percentage. Highpercentages (e.g., 95-100%) can indicate that the sample portion islikely grayscale. The accuracy of the determination that the sampleportion is grayscale can be improved by evaluating the sampled image(i.e., the image from which the sample portion was taken) or othersample portions taken from the same sampled image. After the neutralcount is incremented, the skin tone detection processor can determinewhether more pixels remain to be evaluated (518) as will be discussedbelow.

If the skin tone detection processor determines (510) that a pixel coloris not near neutral, the skin tone detection processor can evaluatewhether the pixel corresponds to skin tone (512). The determination caninvolve delineating in a color space a polygonal region associated withskin tone. The polygonal region can be defined empirically, analyticallyor in another manner (e.g., based on objectives of the skin tonedetection). For example, the polygonal region can include theoverwhelming majority of face-sampled colors based on empirical studiesof images including faces. The polygonal region can be delineated in R-Gspace as shown in FIG. 6. The skin tone detection processor candetermine a pixel color is skin tone by assessing whether the pixelcolor is located inside the polygonal color space region.

The skin tone detection processor can increment a skin tone count (514)if the pixel color is inside the polygonal region. If the pixel color isoutside the polygonal region, the skin tone detection processor can skipincrementing the skin tone count. In this manner, when all the pixelshave been evaluated, a percentage of skin tone pixels to total pixelscan be produced. It can be determined, based on the percentage beinghigher than a given threshold (e.g., 50%, 75% or 90%) that the sampleportion overall, and the image, depict skin.

Alternatively, in some implementations, a skin tone detection processorcan determine whether a pixel is skin tone by determining a distance ofthe pixel color from a skin tone line or skin tone polygonal region in acolor space. Rather than incrementing a skin tone count, the distance ofeach pixel from the line or polygonal region can be summed or averagedto produce an overall distance from skin tone. The overall distance canbe used to determine whether a sample portion overall represents skintone.

In some implementations, the accuracy of evaluating whether a pixelcorresponds to skin tone can be improved by using metadata relating tothe image. For example, Global Positioning System (GPS) information orinformation conforming to the Exchangeable image file format (Exif)specification associated with the image can be used to determine thetime of day and location where an image was captured. The metadata canbe used to subjectively adjust the delineated skin tone region of thecolor space to accommodate the circumstances associated with an image(e.g., adjusting the region to account for dark tones in images capturedwith a camera at night).

After incrementing the skin tone count, the skin tone detectionprocessor can determine (518) whether pixels remain to be evaluated. Forexample, the skin tone detection processor can determine a progressthrough the pixels in a memory representation (e.g., an array) of thesample portion. If all the pixels to be evaluated in a sample portionhave been evaluated, the skin tone processor can end the process 500 ofevaluating sample portion pixels. If the skin tone detection processor,on the other hand, determines (518) that pixels remain to be evaluated,the skin tone detection processor can select the next pixel to beevaluated from the sample portion (504).

In general, as shown in FIG. 6, a polygonal region in a color space canbe delineated to define skin tone. A skin tone detection processor canevaluate whether the colors of pixels from an image (e.g., pixels in asample portion of an image) represent skin tone by ascertaining whetherthe pixel colors are inside or outside the polygonal region.

FIG. 6 is a diagram 600 showing an exemplary skin tone region 604 of acolor space. The diagram 600 can include a two-dimensional, normalizedR-G color space coordinate system representation. A point on thecoordinate system can represent a color in the color space. A red and agreen component of the color can be represented by the location of thepoint. In specific, a horizontal axis 608 can correspond to a redcomponent of a color. The distance of a point, from left to right, canindicate the intensity of the color's red component. A point near thevertical axis can have a red component of lower intensity than a pointfurther from the vertical axis. The vertical axis 602 can correspond toa green component of a color. The distance of a point, from bottom totop, relative to the vertical axis 602 can indicate the intensity of acolor's green component. The potential values of the red and greencomponents can be normalized such that the lowest possible intensity canbe indicated by 0.0 and the highest possible intensity can be indicatedby 1.0. For example, a pixel can have a green component of 1.0 and a redcomponent of 1.0 in the R-G space. A point representing the color of thepixel can be located in the upper-right corner of the diagram 600.

The skin tone region 604 can be delineated using a polygonal region inR-G space. The size and shape of the skin tone region 604 can beestablished empirically. For example, images including actual skindepictions can be analyzed. The colors of pixels corresponding to skintone can be stored. The stored results can be used to generate the skintone region 604.

The skin tone region 604 can include the majority of face-sampledcolors. The faces can correspond to individuals representingsubstantially all global skin tones. In some implementations, the skintone region 604 can be established more narrowly such as to identifycolors characteristic of one or more races. In other implementations,the size or shape of the skin tone region 604 can change based onfurther evaluations of images or based on user input. For example, in animage management application a user can identify faces of individualsnot identified by the image management application. Based on the inputand pixel colors of the identified faces, the skin tone region 604 canbe adapted to more accurately detect the skin tone of faces identifiedby the user.

In some implementations, multiple skin tone regions, such as the skintone region 604, can be used in combination or separately to delineateskin tone colors. In a first example, multiple skin tone regions can beused in combination by combining pixel color test results relative tothe multiple skin tone regions. The multiple skin tone regions, e.g.,can vary in strictness from more to less likely to represent skin tonecolors. In a second example, multiple skin tone regions can be usedseparately by adaptively selecting one or more of the multiple skin toneregions, e.g., to use for a given image or a particular user. Based on,e.g., lighting conditions, similar facial pigmentation, or photographiceffects across multiple sample portions taken from a sampled image, oneor more appropriate skin tone regions from the multiple skin toneregions can be selected (e.g., a skin tone region appropriate foroverexposed images can be used when multiple sample portions from asampled image have similar overexposed characteristics). Using multipleskin tone regions can be adapted to more accurately detect skin tone infaces.

The points of varying shapes represented in the diagram 600 cancorrespond to pixel colors from sample portions of three images. Pointsrepresented as solid circles can correspond to a first sample portion,gray triangles can correspond to a second sample portion and hollowcircles can correspond to a third sample portion.

With respect to the first sample portion, 16 exemplary pixel colors arerepresented as solid circles in the diagram 600. A group of pixel colors614 is within the skin tone region 604. Some of the pixel colors (e.g.,pixel color 622) are outside the skin tone region 604. Given a depictionof a face and skin tone in an image, some pixel colors from a sampleportion of the image can be non-skin tone as a result of non-skinobjects also being depicted (e.g., earrings, lipstick, glasses,clothing, food, etc.). Thus, a threshold can be used for the ratio ofskin tone colors to non-skin tone colors in evaluating whether a sampleportion depicts skin. For example, 10 of the 16 pixel colors, or 63% ofthe pixel colors, associated with the first sample portion are withinthe skin tone region 604. If a threshold is 90%, the first sampleportion can be rejected as not depicting skin tone. However, in someimplementations the evaluation of whether a sample portion representsskin tone can be performed by measuring the distance of each pixel colorto the skin tone region 604. Given the close proximity of the firstsample portion pixel colors to the skin tone region 604, it can bedetermined that the first sample portion does represent skin tone (e.g.,and a face).

With respect to the second sample portion, all of the grey triangles,representing pixel colors, are within the skin tone region 604. Thus, itcan be determined that the second sample portion represents skin tone.

With respect to the third sample portion, the majority of hollow circles620, representing pixel colors, are outside the skin tone region 604.Some pixel colors (e.g., a hollow circle 624) are within the skin toneregion 604. However, given the majority of hollow circles 620 areoutside the skin tone region 604, it can be determined that the thirdsample portion does not represent skin tone.

In general, as shown in FIG. 7, based on an evaluation of pixels from asample portion (e.g., as shown in FIGS. 5 and 6), it can be determinedwhether the pixels overall represent skin tone. The determination can beused in combination with a facial detection to generate a resultindicating the likelihood that a face was accurately detected. Theprocess 700 shown in FIG. 7 can correspond to determining whether pixelsrepresent skin tone (308) in the process 300 shown in FIG. 3.

FIG. 7 is a flowchart showing an exemplary process 700 for accepting orrejecting an image based on skin tone detection. A skin tone detectionprocessor can be configured to determine whether information aboutpixels sampled from an image indicates the image represents skin tone.The information can include counts of pixels based on a classificationof a pixel color (e.g., skin tone count or neutral count). In specific,the skin tone detection processor can receive a neutral count (702) ofpixels evaluated to be substantially neutral. A neutral pixel can lackcolor (e.g., black, gray and white). The count of neutral pixels can beproduced as part of evaluating pixels in a sample portion (e.g.,determining whether a pixel color is substantially neutral (510) andincrementing a neutral count (516), as shown in FIG. 5).

The skin tone detection processor can derive the total number of pixels(704) in an image sample portion. The total pixels can be derived (704)by, e.g., multiplying a width by a height of the sample portion.Alternatively, the total pixels also can be derived (704) byascertaining a size of a memory buffer in which the sample portion isstored.

The skin tone detection processor can determine (706) whether theneutral count represents a high percentage of the total pixels. The skintone detection processor can calculate the percentage by dividing theneutral count by the total pixels. The skin tone detection processor cancompare the percentage to a threshold designating a value considered tobe “high” (e.g., 50%, 75%, or 95%).

If the skin tone detection processor determines (706) that the neutralcount represents a high percentage of the total pixels, the skin tonedetection processor can generate an acceptance result (712).

If, on the other hand, the skin tone detection processor determines(706) that the neutral count does not represent a high percentage of thetotal pixels, the skin tone detection processor can receive a skin tonecount (708). The skin tone count can represent the number of pixels in asample portion that correspond to skin tone. The skin tone count can bedetermined, e.g., as part of the process 500 shown in FIG. 5.

The skin tone detection processor can determine (710) whether the skintone count represents a high percentage of the total pixels. Thedetermination can involve dividing the skin tone count by the number oftotal pixels. The determination can be based on comparing the calculatedpercentage of skin tone pixels to a threshold percentage (e.g., 50%, 90%or 95%).

The skin tone detection processor can determine (710) that the skin tonecount does not represent a high percentage of the total pixels, and cangenerate a rejection result (714). The skin tone detection processoralso can determine (710) that the skin tone count represents a highpercentage of the total pixels, and can generate an acceptance result(712).

In some implementations, rather than generating a Boolean acceptance(712) or rejection result (714), the skin tone detection processor cangenerate a value indicating, e.g., the percentage of pixels having skintone color, or other value as discussed relative to FIG. 2.

A number of implementations have been disclosed herein. Nevertheless, itwill be understood that various modifications may be made withoutdeparting from the spirit and scope of the claims. Accordingly, otherimplementations are within the scope of the following claims.

1. A computer-implemented method for detecting skin tone in an image,the method comprising: sampling an image to generate a sample portion;evaluating pixels in the sample portion to determine whether the pixelscorrespond to skin tone colors; generating, based on the determination,a skin tone result indicating a confidence level that the received imageincludes a depiction of human skin; and providing the skin tone resultto an image management application to indicate a likelihood the imagedepicts a human face.
 2. The computer-implemented method of claim 1,wherein sampling the image further comprises: identifying a regionsubstantially one third as wide as the image, substantially centeredhorizontally relative to the image, substantially one third as tall asthe image, and offset below vertically centered relative to the image.3. The computer-implemented method of claim 1, wherein evaluating pixelsfurther comprises: converting a selected pixel to a normalized red-greencolor space; and comparing the selected pixel to a predetermined skintone region in the normalized red-green color space.
 4. Thecomputer-implemented method of claim 1, wherein evaluating pixelsfurther comprises: generating a skin tone pixel count by comparing thepixels to a predetermined skin tone region in a color space.
 5. Thecomputer-implemented method of claim 4, wherein evaluating pixelsfurther comprises: comparing the skin tone pixel count to a count of thepixels to generate a skin tone percentage; and determining, based on theskin tone percentage and a predetermined skin tone percentage threshold,that the sample portion includes a depiction of human skin.
 6. Thecomputer-implemented method of claim 1, wherein the generated skin toneresult comprises an indication that the image is suitable for facialrecognition processing.
 7. The computer-implemented method of claim 1,wherein the received image comprises a facial-detection rectangleextracted from an original image.
 8. The computer-implemented method ofclaim 1, further comprising: determining that the image is expressed inan artificially modified color environment; and generating a skin toneresult indicating the artificially modified color environment.
 9. Acomputer program product, tangibly encoded on a computer- readablemedium, operable to cause data processing apparatus to performoperations comprising: sampling an image to generate a sample portion;evaluating pixels in the sample portion to determine whether the pixelscorrespond to skin tone colors; generating, based on the determination,a skin tone result indicating a confidence level that the received imageincludes a depiction of human skin; and providing the skin tone resultto an image management application to indicate a likelihood the imagedepicts a human face.
 10. The computer program product of claim 9,wherein sampling the image further comprises: identifying a regionsubstantially one third as wide as the image, substantially centeredhorizontally relative to the image, substantially one third as tall asthe image, and offset below vertically centered relative to the image.11. The computer program product of claim 9, wherein evaluating pixelsfurther comprises: converting a selected pixel to a normalized red-greencolor space; and comparing the selected pixel to a predetermined skintone region in the normalized red-green color space.
 12. The computerprogram product of claim 9, wherein evaluating pixels further comprises:generating a skin tone pixel count by comparing the pixels to apredetermined skin tone region in a color space.
 13. The computerprogram product of claim 12, wherein evaluating pixels furthercomprises: comparing the skin tone pixel count to a count of the pixelsto generate a skin tone percentage; and determining, based on the skintone percentage and a predetermined skin tone percentage threshold, thatthe sample portion includes a depiction of human skin.
 14. The computerprogram product of claim 9, wherein the generated skin tone resultcomprises an indication that the image is suitable for facialrecognition processing.
 15. The computer program product of claim 9,wherein the received image comprises a facial-detection rectangleextracted from an original image.
 16. The computer program product ofclaim 9, the operations further comprising: determining that the imageis expressed in an artificially modified color environment; andgenerating a skin tone result indicating the artificially modified colorenvironment.
 17. A system comprising: an image management application;and one or more computers operable to execute the image managementapplication and to perform operations comprising: sampling an image togenerate a sample portion; evaluating pixels in the sample portion todetermine whether the pixels correspond to skin tone colors; generating,based on the determination, a skin tone result indicating a confidencelevel that the received image includes a depiction of human skin; andproviding the skin tone result to the image management application toindicate a likelihood the image depicts a human face.
 18. The system ofclaim 17, wherein sampling the image further comprises: identifying aregion substantially one third as wide as the image, substantiallycentered horizontally relative to the image, substantially one third astall as the image, and offset below vertically centered relative to theimage.
 19. The system of claim 17, wherein evaluating pixels furthercomprises: converting a selected pixel to a normalized red-green colorspace; and comparing the selected pixel to a predetermined skin toneregion in the normalized red-green color space.
 20. The system of claim17, wherein evaluating pixels further comprises: generating a skin tonepixel count by comparing the pixels to a predetermined skin tone regionin a color space.
 21. The system of claim 20, wherein evaluating pixelsfurther comprises: comparing the skin tone pixel count to a count of thepixels to generate a skin tone percentage; and determining, based on theskin tone percentage and a predetermined skin tone percentage threshold,that the sample portion includes a depiction of human skin.
 22. Thesystem of claim 17, wherein the generated skin tone result comprises anindication that the image is suitable for facial recognition processing.23. The system of claim 17, wherein the received image comprises afacial-detection rectangle extracted from an original image.
 24. Thesystem of claim 17, the operations further comprising: determining thatthe image is expressed in an artificially modified color environment;and generating a skin tone result indicating the artificially modifiedcolor environment.